Ext.define('app.view.system.MySubUserDiaryForm', {
			extend : 'Ext.window.Window',
			id : 'MySubUserDiaryForm',
			layout : 'fit',
			modal : true,
			title : '下属工作日志详细信息',
			height : 400,
			width : 700,
			maximizable : true,
			buttonAlign : 'center',

			initComponent : function() {
				this.formPanel = new Ext.form.Panel({
							layout : {
								type : 'table',
								columns : 2
							},
							bodyStyle : 'padding:10px',
							border : true,
							autoScroll : true,
							defaults : {
								labelWidth : 50,
								width : '100%',
								labelAlign : 'right',
								allowBlank : false,
								xtype : 'textfield'
							},
							items : [{
										colspan : 2,
										fieldLabel : '姓名',
										name : 'student.name'
									}, {
										fieldLabel : '学号',
										name : 'student.regNo'
									}, {
										fieldLabel : '身份证',
										name : 'student.idcard'
									}, {
										colspan : 2,
										fieldLabel : '状态',
										name : 'student.status'
									}, {
										colspan : 2,
										width : 50,
										anchor : '98%',
										bodyStyle : 'margin-left:50px',
										xtype : 'attachpanel',
										name : 'workAttachPanel',
										fieldLabel : '附件1',
										fileNameWidth: 100,
										leftWidth: 350,
										fileCat : 'work'
									}, {
										name : 'student.id',
										xtype : 'hidden',
										value : this.sid == null ? '' : this.sid
									}, {
										xtype : 'hidden',
										name : 'workReplay.fileIds'
									}, {
										xtype : 'hidden',
										name : 'workReplay.fileNames'
									}]
						});
				this.buttons = [{
						text : '保存',
						iconCls : 'btn-save',
						scope : this,
						handler : this.save
					}, {
						text : '取消',
						iconCls : 'btn-cancel',
						scope : this,
						handler : this.cancel
					}];

				this.items = [this.formPanel];
				this.callParent();
				
				if (this.sid) {
					var me = this;
					this.formPanel.loadData({
							url : __ctxPath + '/example/getStudent.do?id=' + this.sid,
							root : 'data',
							preName : 'student',
							success: function() {
								//加载附件
								var workAttachPanel = me.formPanel.getCmpByName('workAttachPanel');
								var ids = me.formPanel.getCmpByName('workReplay.fileIds').getValue();
								workAttachPanel.loadByIds(ids);
								
							}
						});
				}
			},
			// 取消
			cancel : function() {
				this.close();
			},
			// 保存记录
			save : function() {
				//附件处理
				var workAttachPanel = this.formPanel.getCmpByName('workAttachPanel');
				this.formPanel.getCmpByName('workReplay.fileIds').setValue(workAttachPanel.getFileIds());
				this.formPanel.getCmpByName('workReplay.fileNames').setValue(workAttachPanel.getFileNames());
		
				$postForm({
						formPanel : this.formPanel,
						scope : this,
						url : __ctxPath + '/example/saveStudent.do',
						callback : function(fp, action) {
							var gridPanel = Ext.getCmp('MySubUserDiaryGrid');
							if (gridPanel != null) {
								gridPanel.getStore().load();
							}
							this.close();
						}
					});
			}

		});